<?php

namespace app\Tools;

use Yii;

class StaticTool
{
    public static function registerCss($path, $depend = [])
    {
        self::includeFile('css', $path, $depend);
    }

    public static function registerJs($path, $depend = [])
    {
        self::includeFile('js', $path, $depend);
    }

    private static function includeFile($type, $path, $depend)
    {
        if ($type == "css") {
            Yii::$app->getView()->registerCssFile($path, ['depends' => $depend]);
        } else {
            Yii::$app->getView()->registerJsFile($path, ['depends' => $depend]);
        }
    }
}